You are running with an OLD DOS program, probably. Look for a match with '\r' for ENTER, in this case. See if that works for you. (Or just compare with decimal 13.)
Your question is entirely context dependent. Consequentially, absolutely no context is provided in the question.
The expression
(a == '\n') evaluates to true if a holds the value '\n'.
You can examine a to discover what it contains since it doesn't seem to contain what you expect.
Is this rule of C or there's something error in my syntax?